package com.andy.nature.ui.activity

import com.andy.common.base.BaseVMActivity
import com.andy.common.utils.OnViewGlobalLayoutHeightListener
import com.andy.nature.databinding.ActivityCoordinatorBinding
import com.andy.nature.utils.ScreenUtils
import com.andy.nature.vm.CommonViewModel
import dp

/**
 * Author:Andy
 * Date:2023/4/27 17:51
 * Description:CoordinatorActivity
 */
class CoordinatorActivity : BaseVMActivity<ActivityCoordinatorBinding, CommonViewModel>() {

    override fun viewModelClass(): Class<CommonViewModel> {
        return CommonViewModel::class.java
    }

    override fun getViewBinding(): ActivityCoordinatorBinding {
        return ActivityCoordinatorBinding.inflate(layoutInflater)
    }

    override fun initObserve() {
        mBinding?.apply {
            val maxHeight = ScreenUtils.getScreenHeight() - 50.dp
            llBottomSheet.viewTreeObserver.addOnGlobalLayoutListener(OnViewGlobalLayoutHeightListener(llBottomSheet, maxHeight))
        }
    }

    override fun initData() {
        mBinding?.apply {
        }
    }

    override fun initAction() {
        mBinding?.apply {
            vTitle.setClickLeftCallBack {
                finish()
            }
        }
    }

}